package com.gomoku.utils;
public enum GridValueType {
    Grid_EMPTY(0),
    Grid_HUMAN(1),
    Grid_AI(2),
    Grid_NONE(3); // out of map range

    private final int value;

    // 构造函数
    GridValueType(int value) {
        this.value = value;
    }

    // 获取枚举值的整数值
    public int getValue() {
        return value;
    }

    // 根据整数值获取枚举类型
    public static GridValueType fromInt(int i) {
        for (GridValueType type : GridValueType.values()) {
            if (type.getValue() == i) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unexpected value: " + i);
    }
}

